import request from '@/utils/request'

// 创建订单
export function create(data) {
  return request({
    url: '/system/orders/create',
    method: 'post',
    data: data
  })
}

// 更新订单
export function update(data) {
  return request({
    url: '/system/orders/update',
    method: 'put',
    data: data
  })
}

// 删除订单
export function deleteOrders(id) {
  return request({
    url: '/system/orders/delete?id=' + id,
    method: 'delete'
  })
}

// 获得订单
export function get(id) {
  return request({
    url: '/system/orders/get?id=' + id,
    method: 'get'
  })
}

// 获得订单分页
export function getPage(params) {
  return request({
    url: '/system/orders/page',
    method: 'post',
    data:params
  })
}
export function getOrdersPageByCart(params) {
  return request({
    url: '/system/orders/page/byCrt',
    method: 'post',
    data:params
  })
}

export function playOrder(params) {
  return request({
    url: '/system/play/order',
    method: 'post',
    data:params
  })
}

export function getOrdersPublishTrend() {
  return request({
    url: '/system/orders/trend',
    method: 'get'
  })
}

export function getOrdersCount() {
  return request({
    url: '/system/orders/count',
    method: 'get'
  })
}

export function getPriceCount() {
  return request({
    url: '/system/orders/price/count',
    method: 'get'
  })
}
// 导出订单 Excel
export function exportExcel(params) {
  return request({
    url: '/system/orders/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}
